"""
URL configuration for django3 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from django.views.decorators.csrf import csrf_exempt

from app01 import views as user_v
from dtoken import views as dtoken_v

urlpatterns = [
    # 管理员登录
    path('login', dtoken_v.tokens),
    # 用户登录
    path('ulogin', dtoken_v.u_tokens),

    # 管理员
    path('admin', user_v.AdminViews.as_view()),
    path('admin/', include('app01.aurls')),
    # 用户
    path('user', user_v.UserViews.as_view()),
    path('user/', include('app01.urls')),

    # 分类
    path('class', user_v.ComClassView.as_view()),
    path('class/', include('app01.curls')),
    path('class/parentid/<int:nid>', user_v.ParentId),

    # 商品
    path('goods', user_v.GoodsViews.as_view()),
    path('goods/', include('app01.gurls')),

    # 轮播图
    path('banner', user_v.BannerView.as_view()),
    path('banner/', include('app01.burls')),

    # 统计
    path('statistics/sell', user_v.sell),
    path('statistics/dos', user_v.dos),
    path('statistics/per', user_v.per),
    path('statistics/oldsell', user_v.oldsell),
    path('statistics/age', user_v.age),
    path('statistics/ret', user_v.ret),
    path('statistics/qian', user_v.qian),
    path('statistics/mark', user_v.mark),

    # 购物车
    path('Shoppingcart', user_v.ShoppingCart.as_view()),
    path('Shoppingcart/', include('app01.surls')),

    # 地址
    path('address/<str:user>', user_v.UserAddress.as_view()),
    path('address/<str:user>/', include('app01.uaurls')),

    # 订单
    path('product_order', user_v.Product_Order.as_view()),
    path('product_order/', include('app01.purls')),
    path('product_order_list/<str:user>', user_v.Product_Order_List),

]
urlpatterns += static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
